﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Org.BouncyCastle.Asn1.Ocsp;
using System.Data;
using System.IO;
using System.Web.Script.Services;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Script.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace MediaMonitor.WebServicesForAndroid
{
    /// <summary>
    /// Summary description for WebService1
    /// </summary>
    [WebService(Namespace = "http://www.mediamonitor.do/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]

    public class WebService1 : System.Web.Services.WebService
    {
        [WebMethod]
        public string checkAdmin(string username, string password)
        {

            if (username.ToLower() == "admin" && password.ToLower() == "admin")
            {
                return "1"; //"Available";
            }
            else
            {
                return "0"; //"UnAvailable";
            }

        }
        //[ScriptMethod(UseHttpGet = true)]
        //[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json, XmlSerializeString = false)]
        [OperationContract(Name = "Create")]
        [WebInvoke(UriTemplate = "/Create", Method = "POST",
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json)]
        public bool Create(StringBuilder strObj)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();

            Data custObj = js.Deserialize<Data>(strObj.ToString());

            bool Inserted = false;



            return Inserted;
            
            
            
           
        }
    }
}
public class Data
{
    public string RealCost { get; set; }
    public string Category { get; set; }
}
public class Json
{
    public string JsontoString(string obj)
    {
        JavaScriptSerializer js = new JavaScriptSerializer();
        StringBuilder sb = new StringBuilder();
        js.Serialize(obj, sb);
        return sb.ToString();
    }

    public string StringtoJson(string obj)
    {

        JavaScriptSerializer js = new JavaScriptSerializer();
        Data custObj = js.Deserialize<Data>(obj.ToString());
        return custObj.ToString();
    }
}